<?php
session_start();
require_once('../control/showHome.php');
require_once('../control/lookPage.php');
pdlook();
?>

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>添加文章</title>
</head>
<link rel="stylesheet" href="../style/css/addArtIndex.css">
<link rel="stylesheet" href="../style/css/font-face.css">

<body>
  <div class="add-box">
    <!-- 头部 -->
    <div class="header">
      <a class="header-title" href="../view/index.php">说点吧</a>
      <?php
      if (isset($_SESSION['uName']) && trim($_SESSION['uName'] != '')) {
        $user = selectUser($_SESSION['uName']);
        echo <<<loginbefore
        <!-- 登录之后 -->
          <div class="user-logining">
            <img src="../image/avatar/$user[avatar]" alt="">
            <span>$user[uName]</span>
            <i class="iconfont icon-xiangxia1"></i>
          </div>
        loginbefore;
      } else {
        echo <<<loginafter
          <!-- 登录之前 -->
          <span class="header-login iconfont icon-morentouxiang">登录 / 注册</span>
        loginafter;
      }
      ?>

      <div class="user">
        <!-- 用户登录之后的下拉框 -->
        <ul>
          <li><i class="iconfont icon-morentouxiang"></i><span>个人主页</span></li>
          <li class="user-out"><i class="iconfont icon-tuichu"></i><span>退出登录</span></li>
        </ul>
      </div>
    </div>
    <!-- 退出模态框 -->
    <div class="modal-out">
      <div class="modal-out-box">
        <div class="modal-out-box-msg">
          <i class="iconfont icon-tuichu"></i>
          <h2>退出登录</h2>
          <span>确定要退出登录吗？</span>
        </div>
        <form action="../control/user.php" method="get">
          <input type="hidden" name="action" value="out">
          <button type="button">取消</button>
          <input type="submit" value="退出登录">
        </form>
      </div>
    </div>

    <div class="title">
      <form action="../control/addArt.php" method="post">
        <input type="hidden" value="uploadArt" name="action">
        <input type="hidden" value="<?php echo $_SESSION['uName']; ?>" name="userMsg" class="userMsg">
        <div class="form-top">
          <h2>添加文章</h2>
          <div class="form-top-btn">
            <button>保存编辑</button>
            <input type="submit" value="上传">
          </div>
        </div>

        <div class="form-msg">
          <div class="selectInp">
            <h3>文章所属板块：</h3>
            <select name="artBoard">
              <option value="0" selected>请选择你的板块</option>
              <?php
              foreach ($GLOBALS['addArtBoard'] as $val) {
                echo " <option value='$val[board_id]'>$val[board_name]</option>";
              }
              ?>

            </select>
          </div>
          <div class="art-title">
            <h3>文章标题：</h3>
            <input type="text" maxlength="120" placeholder="输入文章标题(<120字)" name="artTitle">
          </div>
          <div class="art-content">
            <h3>文章内容：</h3>
            <textarea name="text" style="resize: none;" cols="230" rows="25" placeholder="放入你的文章..."
              name="artContent"></textarea>
          </div>
          <input type="reset" value="清空" class="resetInp">
        </div>
      </form>
    </div>

    <div class="save">
      保存成功
    </div>
  </div>
</body>
<script src="../style/js/addArtIndex.js"></script>

</html>